package com.joysuch.wwyt.mh.bean;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author ZhangDong
 * @Date 2020/5/25 11:34
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CertSummaryDto {

    //日期顺序集
    private List<LocalDate> localDateList;
    //数量顺序集
    private List<Integer> sum;

    public static CertSummaryDto getDto(TreeMap<LocalDate, Integer> treeMap) {
        Set<LocalDate> localDates = treeMap.keySet();
        ArrayList<LocalDate> localDates1 = Lists.newArrayList(localDates);
        Collection<Integer> values = treeMap.values();
        List<Integer> collect = values.stream().collect(Collectors.toList());
        return new CertSummaryDto(localDates1, collect);
    }
}
